package com.scyshkj.university.wechat.pay;

import lombok.Data;
import org.springframework.util.StringUtils;

/**
 * Created by 唐旭 on 2016/11/20.
 */
@Data
public class WechatUserInfo {
    private String subscribe;
    private String openid;
    private String nickname;
    private String sex;
    private String province;
    private String city;
    private String country;
    private String headimgurl;
    private String privilege;
    private String subscribe_time;
    private String unionid;
    private String remark;
    private String groupid;

    public WechatUserInfo() {
    }

    public WechatUserInfo(WechatUserInfo userInfo) {
        this.subscribe = userInfo.getSubscribe();
        this.openid = userInfo.getOpenid();
        if (!StringUtils.isEmpty(userInfo.getNickname())) {
            this.nickname = userInfo.getNickname().replaceAll("[^\\u0000-\\uFFFF]", "?");
        }

        this.sex = userInfo.getSex();
        this.province = userInfo.getProvince();
        this.city = userInfo.getCity();
        this.country = userInfo.getCountry();
        this.headimgurl = userInfo.getHeadimgurl();
        this.privilege = userInfo.getPrivilege();
        this.unionid = userInfo.getUnionid();
        this.subscribe_time = userInfo.getSubscribe_time();
        this.remark = userInfo.getRemark();
        this.groupid = userInfo.getGroupid();
    }
}
